import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-03-24
 * Time: 21:26
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();
        int res = 0;
        if (str1 == null || str1.length() == 0) {
            res = check(new StringBuilder(str2));
        } else if (str2 == null || str2.length() == 0){
            res = check(new StringBuilder(str1));
        } else {
            res = count(str1, str2);
        }
        System.out.println(res);
    }

    public static int count(String str1, String str2) {
        StringBuilder sb = new StringBuilder();
        int n1 = str1.length();
        int count = 0;
        for (int i = 0; i <= n1; i++) {
            sb.setLength(0);
            sb.append(str1, 0, i).append(str2).append(str1, i, n1);
            count += check(sb);
        }
        return count;
    }

    public static int check(StringBuilder sb) {
        if (sb == null || sb.length() == 0) {
            return 0;
        }
        int right = sb.length() - 1;
        int left = 0;
        while (left < right) {
            if (sb.charAt(left) != sb.charAt(right)) {
                return 0;
            }
            left++;
            right--;
        }
        return 1;
    }
}

